// src/router/index.js
import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    //登录之后展示的页面路径
    path: '/',
    name: 'layout',
    component: ()=>import('../view/home/index.vue')
  },
  {
    //登录页面
    path: '/login',
    name: 'login',
    component: ()=>import('../view/login/index.vue')
  },
  {
    //错误页面
       path: '/404',
    name: '404',
    component: ()=>import('../view/404/index.vue')
  },{
    path:'/:pathhMath(.*)*',
    name:'any',
    redirect:'/404'
  }
]
//创建router实例
const router = createRouter({
  history: createWebHistory(), //路由路径的模式
  routes ,
  //滚动条行为，用于控制页面切换时的滚动行为
  scrollBehavior () {
    return{
      left:0,
      top:0
    }
  }
})
export default router